package com.unknow.first.dapp.admin.account.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

public final class AccountConstants {

    public static final String LOG_BIZ_TYPE = "Address-account";

    private AccountConstants() {

    }

    /**
     * 结算类型,根据业务需要增加或者减少
     */
    @AllArgsConstructor
    @Getter
    public enum TradeType implements ITradeTypeEnum {
        TRANSFER(-10, "内部转账", "addressAccount.TradeType.transfer", true),
        PAY(10, "充值", "addressAccount.TradeType.pay", true), //后台充值
        BACKGROUND_AIRDROP(12, "空投", "addressAccount.TradeType.airDrop", true),

        FREE(13, "冻结(增加冻结金额)", "addressAccount.TradeType.free", false), // 冻结
        FREE_BALANCE(14, "冻结(扣减余额)", "addressAccount.TradeType.free_balance", false), // 冻结
        UNFREE(15, "解冻(减少冻结金额)", "addressAccount.TradeType.unfree", false), // 解冻
        UNFREE_BALANCE(16, "解冻(增加余额)", "addressAccount.TradeType.unfree_balance", false), // 解冻

        WITHDRAW(20, "提现", "addressAccount.TradeType.withdraw", true), //后台提现
        WITHDRAW_CHARGE(22, "提现手续费", "addressAccount.TradeType.WITHDRAW_CHARGE", true),
        FLASH_SWAP(23, "闪兑", "addressAccount.TradeType.FLASH_SWAP", true),
        FLASH_SWAP_CHARGE(24, "闪兑手续费", "addressAccount.TradeType.FLASH_SWAP_CHARGE", true),
//        WITHDRAW_FREEZE(25, "提现冻结", "addressAccount.TradeType.withdrawFreeze", true),
//        WITHDRAW_UNFREEZE(26, "提现解冻", "addressAccount.TradeType.withdrawUnfreeze", true),

        BACKGROUND_PAY(30, "后台充值", "addressAccount.TradeType.BACKGROUND_PAY", false),
        BACKGROUND_WITHDRAW(31, "后台提现", "addressAccount.TradeType.BACKGROUND_WITHDRAW", false),


        ;
        public final int value;     // 值
        public final String name;  // 名称和描述
        public final String i18nValue;  // 国际化
        public final boolean isShow;  // 前端是否显示
    }

    /**
     * 系统账户类型， 10：手续费账户 11：烧伤账户 及其它业务自定义的账户枚举继承ISystemAddressTypeEnum,业务系统中必须定义在com.unknow.first.dapp.admin.account.constants包里
     */
    @AllArgsConstructor
    @Getter
    public enum SystemAddressType implements ISystemAddressTypeEnum {
        SYSTEM_ACCOUNT(10, "默认系统账户", "addressAccount.system.addressType.systemAccount"),
        SERVICE_CHARGE(11, "手续费账户", "addressAccount.system.addressType.serviceCharge"),
        FIRE_BURN(12, "烧伤账户", "addressAccount.system.addressType.fireBurn"),
        TOP_ADDRESS(13, "顶层地址", "addressAccount.system.addressType.topAddress");
        public final int value;     // 值
        public final String name;  // 名称和描述
        public final String i18nValue;  // 国际化
    }

    @AllArgsConstructor
    public enum AccountStatus {
        NORMAL(10, "正常可用"),
        FORBIDDEN(99, "禁用"),
        ;
        public final int status;
        public final String desc;
    }

    @AllArgsConstructor
    public enum CoinConfigStatus {
        NORMAL(10, "正常可用"),
        ONLY_RECHARGE(20, "仅能冲值"),
        ONLY_WITHDRAW(30, "仅能提现"),
        CLOSE_RECHARGE_WITHDRAW(40, "关闭冲提"),
        FORBIDDEN(99, "禁用"),
        ;
        public final int status;
        public final String desc;
    }

    @AllArgsConstructor
    public enum CoinConfigTransferStatus {
        NORMAL(10, "正常可用"),
        FORBIDDEN(20, "禁用"),
        ;
        public final int status;
        public final String desc;
    }

    /**
     * 10：结算中 20：结算完成 30：结算出错
     */
    @AllArgsConstructor
    public enum TradeStatus {
        AUDIT_FAIL(-5, "审核不通过", "addressAccount.TradeStatus.AUDIT_FAIL"),
        ERROR(-30, "错误", "addressAccount.TradeStatus.ERROR"),
        AUDITING(5, "审核中", "addressAccount.TradeStatus.AUDITING"),
        ING(10, "结算中", "addressAccount.TradeStatus.ING"),
        DONE(20, "完成", "addressAccount.TradeStatus.DONE"),
        UNCONFIRMED(40, "待确认", "addressAccount.TradeStatus.UNCONFIRMED"),  // 比如提现时，上链后状态未确认的情况
        ;
        public final int value;     // 值
        public final String name;  // 名称和描述
        public final String i18nValue;  // 国际化
    }

    /**
     * 支付备注字段
     */
    @AllArgsConstructor
    public enum TradeRemarkColumn {
        PAY_TO("payTo", "接收人"),
        PAY_BY("payBy", "付款人"),
        ORDER_NO("orderNo", "订单号"),
        SOURCE_TADE_TYPE("sourceTradeType", "来源交易类型"),// 用于进入系统账户时记录下资金的实际来源
        DESCRIPTION("description", "描述内容"),// 用于进入系统账户时记录下资金的实际来源
        ;
        public final String code;     // 值
        public final String name;  // 名称和描述
    }


    /**
     * 合约符号
     */
    @AllArgsConstructor
    public enum ContractSymbol {
        ERC20PAY_CONTRACT("ERC20PAY", "ERC20PAY"),
        ;
        public final String symbol;
        public final String name;
    }


    /**
     *
     */

    @AllArgsConstructor
    public enum AddressAccountError {
        ERROR_CHARGE_IS_NOT_ENOUGH("address.account.error.charge.isNotEnough", "手续费余额不足"),
        ERROR_BALANCE_OUT_RANGE(" addressAccount.error.balanceOutRange", "余额或手续费不足");
        public final String i18n;
        public final String description;
    }

    @AllArgsConstructor
    public enum WithdrawChargeType {
        BY_PERCENT(10, "address.account.charge.type.percent", "按比例"),
        BY_FIX(20, "address.account.charge.type.fixed", "单笔固定");
        public final Integer value;
        public final String i18n;
        public final String description;
    }


    /**
     * 资金明细显示状态
     */
    @AllArgsConstructor
    public enum AccountDetailIsShow {

        SHOW(1, "显示"),
        HIDE(0, "隐藏"),
        ;
        public int value;
        public String name;
    }

    /**
     * 充值状态
     */
    @AllArgsConstructor
    public static enum RechargeStatus {

        CONFIRM_ING(10,"确认中"),
        CONFIRM_SUCCESS(20,"已入账"),
        CONFIRM_FAIL(30,"无效交易"),
        ;
        public int value;
        public String name;
    }

    /**
     * 提现状态
     */
    @AllArgsConstructor
    public static enum WithdrawStatus {
        AUDITING(10, "待审核"),

        AUDIT_PASS(20, "审核通过"),
        AUDIT_REFUSE(30, "审核拒绝"),
        WITHDRAW_SUCCESS(40, "提现完成"),
        ;
        public final int value;     // 值
        public final String name;  // 名称和描述
    }
}
